home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / tarsrc Folder / dialog.c < prev    next >
Text File  |  1993-11-28  |  15KB  |  724 lines

  1. /*
  2.  * Macintosh Tar
  3.  *
  4.  * The routines in this file deal with the dialogs presented to the user.
  5.  *
  6.  * Written by Craig Ruff.
  7.  *
  8.  * Note that the dialog dealing with directory selection is in dir.c.
  9.  */
  10.  
  11. #include "tar.h"
  12. #include <Disks.h>
  13. #include <Resources.h>
  14. #include <SegLoad.h>
  15.  
  16. /*
  17.  * Dialog definitions
  18.  */
  19. #define aboutID        128    /* The "About ..." dialog */
  20. #define okItem        1
  21.  
  22. #define blockID        129    /* The block size dialog */
  23. #define sizeItem    3
  24.  
  25. #define typeID        131    /* Creator/Type dialog */
  26. #define creatorItem    3
  27. #define typeItem    4
  28. #define saveItem    7
  29.  
  30. #define floppyID    132    /* Insert floppy dialog */
  31. #define ejectItem    3
  32.  
  33. #define tapeID        133    /* Tape options dialog */
  34. #define scsiIDItem    3
  35. #define minTOItem    4
  36. #define motionTOItem    5
  37. #define rewindTOItem    6
  38. #define densityItem    7
  39. #define bufModeItem    8
  40. #define speedItem    9
  41. #define variableItem    10
  42. #define modeSelectItem    11
  43.  
  44. /*
  45.  * Alert Definitions
  46.  */
  47. #define badBlockID    129        /* Block size incorrect alert */
  48. #define osErrID        130        /* Generic OS Error alert */
  49. #define pgmErrID    131        /* Program logic error alert */
  50. #define versionID    132        /* Must run under 6.0.5 or later alert */
  51. #define askipID        133        /* Skipping archive file note */
  52. #define stkErrID    134        /* Stack error alert */
  53. #define dfID        135        /* Disk full alert */
  54. #define hfsID        136        /* Can only handle HFS volumes */
  55. #define badTapeID    137        /* Bad SCSI Tape ID alert */
  56. #define stopGoID    138        /* Generic Retry/Quit alert */
  57. #define genericID    139        /* Generic alert */
  58.  
  59. /*
  60.  * AboutFilter - manage the "About ..." dialog
  61.  *
  62.  *    Returns when the mouse or a key is pressed anywhere.
  63.  */
  64. pascal Boolean
  65. AboutFilter(theDialog, theEvent, itemHit)
  66. DialogPtr    theDialog;
  67. EventRecord    *theEvent;
  68. short        *itemHit;
  69. {
  70. #pragma unused(theDialog)
  71.  
  72.     switch (theEvent->what) {
  73.     case keyDown:
  74.     case mouseDown:
  75.         *itemHit = 1;
  76.         return(true);
  77.         break;
  78.  
  79.     default:
  80.         return(false);
  81.         break;
  82.     }
  83. }
  84.  
  85. /*
  86.  * DoAboutBox - put the "About ..." dialog on the screen
  87.  */
  88. void
  89. DoAboutBox(void)
  90. {
  91.     short        itemHit, itemType;
  92.     WindowPtr    myWindow;
  93.     GrafPtr        thePort;
  94.     PenState    pn;
  95.     Rect        okBox;
  96.     Handle        okHdl;
  97.  
  98.     GetPort(&thePort);
  99.     myWindow = GetNewDialog(aboutID, nil, (WindowPtr) -1);
  100.     GetDItem(myWindow, okItem, &itemType, &okHdl, &okBox);
  101.     SetPort(myWindow);
  102.     InsetRect(&okBox, -4, -4);
  103.     GetPenState(&pn);
  104.     PenSize(3, 3);
  105.     FrameRoundRect(&okBox, 16, 16);
  106.     SetPenState(&pn);
  107.     do {
  108.         ModalDialog(AboutFilter, &itemHit);
  109.     } while (itemHit != 1);
  110.  
  111.     DisposDialog(myWindow);
  112.     SetPort(thePort);
  113. }
  114.  
  115. /*
  116.  * ValidBlockSize - checks the user entered blocksize for validity.
  117.  *
  118.  *    Returns true if ok, false if bad.
  119.  */
  120. Boolean
  121. ValidBlockSize(theDialog)
  122. DialogPtr    theDialog;
  123. {
  124.     long    n;
  125.     short    type;
  126.     Handle    hdl;
  127.     Rect    box;
  128.     char    text[256];
  129.  
  130.     GetDItem(theDialog, sizeItem, &type, &hdl, &box);
  131.     GetIText(hdl, text);
  132.     StringToNum(text, &n);
  133.  
  134.     /*
  135.      * These limits are somewhat arbitrary.
  136.      */
  137.     if ((n < 1) || (n > 256)) {
  138.         NoteAlert(badBlockID, nil);
  139.         SelIText(theDialog, sizeItem, 0, 32767);
  140.         return(false);
  141.     }
  142.  
  143.     pref.blocking = (int) n;
  144.     pref.blockSize = pref.blocking * RECORDSIZE;
  145.     return(true);
  146. }
  147.  
  148. Rect        okBox;        /* ok Box location (gotten once for speed) */
  149. ControlHandle    okHdl;        /* ok Box handle */
  150.  
  151. /*
  152.  * BlockFilter - manage user events during the block size dialog
  153.  *
  154.  *    Allows numeric entry and editing, validates size.
  155.  *    Returns true if the dialog should exit, false to continue.
  156.  */
  157. pascal Boolean
  158. BlockFilter(theDialog, theEvent, itemHit)
  159. DialogPtr    theDialog;
  160. EventRecord    *theEvent;
  161. short        *itemHit;
  162. {
  163.     long    t;
  164.     Point    lpt;
  165.     GrafPtr    savedPort;
  166.  
  167.     switch (theEvent->what) {
  168.     case keyDown:
  169.         switch ((char) (theEvent->message & charCodeMask)) {
  170.         case RETURN:
  171.         case ENTER:
  172.             goto validate;
  173.             break;
  174.  
  175.         case '0': case '1': case '2': case '3': case '4':
  176.         case '5': case '6': case '7': case '8': case '9':
  177.         case TAB: case  BS:
  178.             break;
  179.  
  180.         default:
  181.             SysBeep(5);
  182.             theEvent->what = nullEvent;
  183.             break;
  184.         }
  185.         break;
  186.  
  187.     case mouseDown:
  188.         lpt = theEvent->where;
  189.         GetPort(&savedPort);
  190.         SetPort((GrafPtr) theDialog);
  191.         GlobalToLocal(&lpt);
  192.         SetPort(savedPort);
  193.         if (PtInRect(lpt, &okBox)) {
  194. validate:        if (ValidBlockSize(theDialog)) {
  195.                 *itemHit = ok;
  196.                 HiliteControl(okHdl, 1);
  197.                 Delay(8L, &t);
  198.                 HiliteControl(okHdl, 0);
  199.                 return(true);
  200.             } else
  201.                 theEvent->what = nullEvent;
  202.         }
  203.         break;
  204.     }
  205.  
  206.     return(false);
  207. }
  208.  
  209. /*
  210.  * ValidTapeID - checks the user entered tape id for validity.
  211.  *
  212.  *    Returns true if ok, false if bad.
  213.  */
  214. Boolean
  215. ValidTapeID(theDialog)
  216. DialogPtr    theDialog;
  217. {
  218.     long    n;
  219.     short    type;
  220.     Handle    hdl;
  221.     Rect    box;
  222.     char    text[256];
  223.  
  224.     GetDItem(theDialog, scsiIDItem, &type, &hdl, &box);
  225.     GetIText(hdl, text);
  226.     StringToNum(text, &n);
  227.  
  228.     /*
  229.      * Mac is always ID 7
  230.      */
  231.     if ((n < 0) || (n > 6)) {
  232.         NoteAlert(badTapeID, nil);
  233.         SelIText(theDialog, scsiIDItem, 0, 32767);
  234.         return(false);
  235.     }
  236.  
  237.     pref.tapeVars.unit = (int) n;
  238.     return(true);
  239. }
  240.  
  241. Rect        variableBox;        /* force variable Ctl location (gotten once for speed) */
  242. ControlHandle    variableHdl;        /* force variable Ctl handle */
  243. Rect        modeBox;        /* force mode select Ctl location (gotten once for speed) */
  244. ControlHandle    modeHdl;        /* force mode select Ctl handle */
  245.  
  246. /*
  247.  * TapeFilter - manage user events during the tape id dialog
  248.  *
  249.  *    Allows numeric entry and editing, validates id.
  250.  *    Returns true if the dialog should exit, false to continue.
  251.  */
  252. pascal Boolean
  253. TapeFilter(theDialog, theEvent, itemHit)
  254. DialogPtr    theDialog;
  255. EventRecord    *theEvent;
  256. short        *itemHit;
  257. {
  258.     long    t;
  259.     Point    lpt;
  260.     GrafPtr    savedPort;
  261.  
  262.     switch (theEvent->what) {
  263.     case keyDown:
  264.         switch ((char) (theEvent->message & charCodeMask)) {
  265.         case RETURN:
  266.         case ENTER:
  267.             goto validate;
  268.             break;
  269.  
  270.         case '0': case '1': case '2': case '3': case '4':
  271.         case '5': case '6': case '7': case '8': case '9':
  272.         case TAB: case  BS:
  273.             break;
  274.  
  275.         default:
  276.             SysBeep(5);
  277.             theEvent->what = nullEvent;
  278.             break;
  279.         }
  280.         break;
  281.  
  282.     case mouseDown:
  283.         lpt = theEvent->where;
  284.         GetPort(&savedPort);
  285.         SetPort((GrafPtr) theDialog);
  286.         GlobalToLocal(&lpt);
  287.         SetPort(savedPort);
  288.         if (PtInRect(lpt, &okBox)) {
  289. validate:        if (ValidTapeID(theDialog)) {
  290.                 *itemHit = ok;
  291.                 HiliteControl(okHdl, 1);
  292.                 Delay(8L, &t);
  293.                 HiliteControl(okHdl, 0);
  294.                 return(true);
  295.             } else
  296.                 theEvent->what = nullEvent;
  297.                 
  298.         } else if (PtInRect(lpt, &variableBox)) {
  299.             t = GetCtlValue(variableHdl) ? 0 : 1;
  300.             SetCtlValue(variableHdl, t);
  301.             theEvent->what = nullEvent;
  302.                 
  303.         } else if (PtInRect(lpt, &modeBox)) {
  304.             t = GetCtlValue(modeHdl) ? 0 : 1;
  305.             SetCtlValue(modeHdl, t);
  306.             theEvent->what = nullEvent;
  307.         }
  308.         break;
  309.     }
  310.  
  311.     return(false);
  312. }
  313.  
  314. /*
  315.  * CreatorTypeFilter - manage user events during the Creator/Type dialog
  316.  *
  317.  */
  318. pascal Boolean
  319. CreatorTypeFilter(theDialog, theEvent, itemHit)
  320. DialogPtr    theDialog;
  321. EventRecord    *theEvent;
  322. short        *itemHit;
  323. {
  324.     long    t;
  325.     Point    lpt;
  326.     GrafPtr    savedPort;
  327.  
  328.     switch (theEvent->what) {
  329.     case keyDown:
  330.         switch ((char) (theEvent->message & charCodeMask)) {
  331.         case RETURN:
  332.         case ENTER:
  333.             goto done;
  334.             break;
  335.  
  336.         default:
  337.             break;
  338.         }
  339.         break;
  340.  
  341.     case mouseDown:
  342.         lpt = theEvent->where;
  343.         GetPort(&savedPort);
  344.         SetPort((GrafPtr) theDialog);
  345.         GlobalToLocal(&lpt);
  346.         SetPort(savedPort);
  347.         if (PtInRect(lpt, &okBox)) {
  348. done:
  349.             *itemHit = ok;
  350.             HiliteControl(okHdl, 1);
  351.             Delay(8L, &t);
  352.             HiliteControl(okHdl, 0);
  353.             return(true);    
  354.         }
  355.         break;
  356.     }
  357.  
  358.     return(false);
  359. }
  360.  
  361. /*
  362.  * FloppyFilter - manage user events during the Floppy dialog
  363.  *
  364.  */
  365.  
  366. int    drive;
  367.  
  368. pascal Boolean
  369. FloppyFilter(theDialog, theEvent, itemHit)
  370. DialogPtr    theDialog;
  371. EventRecord    *theEvent;
  372. short        *itemHit;
  373. {
  374. #pragma unused(theDialog)
  375.     EventRecord    e;
  376.     
  377.     if (theEvent->what == keyDown) {
  378.         switch ((char) (theEvent->message & charCodeMask)) {
  379.         case RETURN:
  380.         case ENTER:
  381.             *itemHit = cancel;
  382.             return(true);
  383.  
  384.         default:
  385.             break;
  386.         }
  387.     }
  388.  
  389.     if (GetOSEvent(diskMask, &e)) {
  390.         drive = e.message & 0xffff;
  391.         *itemHit = ok;
  392.         return(true);
  393.     }
  394.     
  395.     return(false);
  396. }
  397.  
  398. /*
  399.  * DoBlockSize - put the block size dialog on the screen
  400.  *
  401.  *    Puts the current block size into the edit field.
  402.  */
  403. void
  404. DoBlockSize(void)
  405. {
  406.     short        itemHit;
  407.     DialogPtr    theDialog;
  408.     Handle        hdl;
  409.     short        type;
  410.     Rect        box;
  411.     char        text[256];
  412.     PenState    pn;
  413.     GrafPtr        thePort;
  414.  
  415.     GetPort(&thePort);
  416.     theDialog = GetNewDialog(blockID, nil, (WindowPtr) -1);
  417.     GetDItem(theDialog, sizeItem, &type, &hdl, &box);
  418.     NumToString((long) pref.blocking, text);
  419.     SetIText(hdl, text);
  420.     SelIText(theDialog, sizeItem, 0, 32767);
  421.     GetDItem(theDialog, ok, &type, (Handle *) &okHdl, &okBox);
  422.     SetPort(theDialog);
  423.     InsetRect(&okBox, -4, -4);
  424.     GetPenState(&pn);
  425.     PenSize(3, 3);
  426.     FrameRoundRect(&okBox, 16, 16);
  427.     SetPenState(&pn);
  428.     do {
  429.         ModalDialog(BlockFilter, &itemHit);
  430.     } while ((itemHit != ok) && (itemHit != cancel));
  431.  
  432.     DisposDialog(theDialog);
  433.     SetPort(thePort);
  434. }
  435.  
  436. /*
  437.  * DoTapeOptions - put the tape unit number dialog on the screen
  438.  *
  439.  *    Puts the tape unit number into the edit field.
  440.  */
  441. void
  442. DoTapeOptions(void)
  443. {
  444.     short        itemHit;
  445.     DialogPtr    theDialog;
  446.     Handle        hdl;
  447.     short        type;
  448.     Rect        box;
  449.     char        text[256];
  450.     PenState    pn;
  451.     GrafPtr        thePort;
  452.     long        n;
  453.  
  454.     GetPort(&thePort);
  455.     theDialog = GetNewDialog(tapeID, nil, (WindowPtr) -1);
  456.     GetDItem(theDialog, scsiIDItem, &type, &hdl, &box);
  457.     NumToString((long) pref.tapeVars.unit, text);
  458.     SetIText(hdl, text);
  459.     GetDItem(theDialog, minTOItem, &type, &hdl, &box);
  460.     NumToString((long) pref.tapeVars.minTO, text);
  461.     SetIText(hdl, text);
  462.     GetDItem(theDialog, motionTOItem, &type, &hdl, &box);
  463.     NumToString((long) pref.tapeVars.motionTO, text);
  464.     SetIText(hdl, text);
  465.     GetDItem(theDialog, rewindTOItem, &type, &hdl, &box);
  466.     NumToString((long) pref.tapeVars.rewindTO, text);
  467.     SetIText(hdl, text);
  468.     GetDItem(theDialog, densityItem, &type, &hdl, &box);
  469.     NumToString((long) pref.tapeVars.densityCode, text);
  470.     SetIText(hdl, text);
  471.     GetDItem(theDialog, speedItem, &type, &hdl, &box);
  472.     NumToString((long) pref.tapeVars.speed, text);
  473.     SetIText(hdl, text);
  474.     GetDItem(theDialog, bufModeItem, &type, &hdl, &box);
  475.     NumToString((long) pref.tapeVars.bufMode, text);
  476.     SetIText(hdl, text);
  477.     GetDItem(theDialog, variableItem, &type, (Handle *) &variableHdl, &variableBox);
  478.     SetCtlValue(variableHdl, (pref.tapeVars.forceVariable) ? 1 : 0);
  479.     GetDItem(theDialog, modeSelectItem, &type, (Handle *) &modeHdl, &modeBox);
  480.     SetCtlValue(modeHdl, (pref.tapeVars.forceModeSelect) ? 1 : 0);
  481.     
  482.     SelIText(theDialog, scsiIDItem, 0, 32767);
  483.     GetDItem(theDialog, ok, &type, (Handle *) &okHdl, &okBox);
  484.     SetPort(theDialog);
  485.     InsetRect(&okBox, -4, -4);
  486.     GetPenState(&pn);
  487.     PenSize(3, 3);
  488.     FrameRoundRect(&okBox, 16, 16);
  489.     SetPenState(&pn);
  490.     do {
  491.         ModalDialog(TapeFilter, &itemHit);
  492.     } while ((itemHit != ok) && (itemHit != cancel));
  493.  
  494.     if (itemHit == ok) {
  495.         GetDItem(theDialog, minTOItem, &type, &hdl, &box);
  496.         GetIText(hdl, text);
  497.         StringToNum(text, &n);
  498.         pref.tapeVars.minTO = n;
  499.         GetDItem(theDialog, motionTOItem, &type, &hdl, &box);
  500.         GetIText(hdl, text);
  501.         StringToNum(text, &n);
  502.         pref.tapeVars.motionTO = n;
  503.         GetDItem(theDialog, rewindTOItem, &type, &hdl, &box);
  504.         GetIText(hdl, text);
  505.         StringToNum(text, &n);
  506.         pref.tapeVars.rewindTO = n;
  507.         GetDItem(theDialog, densityItem, &type, &hdl, &box);
  508.         GetIText(hdl, text);
  509.         StringToNum(text, &n);
  510.         pref.tapeVars.densityCode = n;
  511.         GetDItem(theDialog, speedItem, &type, &hdl, &box);
  512.         GetIText(hdl, text);
  513.         StringToNum(text, &n);
  514.         pref.tapeVars.speed = n;
  515.         GetDItem(theDialog, bufModeItem, &type, &hdl, &box);
  516.         GetIText(hdl, text);
  517.         StringToNum(text, &n);
  518.         pref.tapeVars.bufMode = n;
  519.         pref.tapeVars.forceVariable = GetCtlValue(variableHdl) ? true : false;
  520.         pref.tapeVars.forceModeSelect = GetCtlValue(modeHdl) ? true : false;
  521.     }
  522.     
  523.     DisposDialog(theDialog);
  524.     SetPort(thePort);
  525. }
  526.  
  527. /*
  528.  * DoCreatorType - put the set Creator/Type dialog on the screen
  529.  *
  530.  *    Puts the current Creator and Type into the edit field.
  531.  */
  532. void
  533. DoCreatorType(void)
  534. {
  535.     short        itemHit;
  536.     DialogPtr    theDialog;
  537.     Handle        hdl;
  538.     short        type;
  539.     int        n;
  540.     Rect        box;
  541.     char        text[256];
  542.     PenState    pn;
  543.     GrafPtr        thePort;
  544.  
  545.     GetPort(&thePort);
  546.     theDialog = GetNewDialog(typeID, nil, (WindowPtr) -1);
  547.     GetDItem(theDialog, creatorItem, &type, &hdl, &box);
  548.     text[0] = 4;
  549.     strncpy(&text[1], pref.creator, 4);
  550.     SetIText(hdl, text);
  551.     GetDItem(theDialog, typeItem, &type, &hdl, &box);
  552.     text[0] = 4;
  553.     strncpy(&text[1], pref.type, 4);
  554.     SetIText(hdl, text);
  555.     SelIText(theDialog, creatorItem, 0, 32767);
  556.     GetDItem(theDialog, ok, &type, (Handle *) &okHdl, &okBox);
  557.     SetPort(theDialog);
  558.     InsetRect(&okBox, -4, -4);
  559.     GetPenState(&pn);
  560.     PenSize(3, 3);
  561.     FrameRoundRect(&okBox, 16, 16);
  562.     SetPenState(&pn);
  563.     do {
  564.         ModalDialog(CreatorTypeFilter, &itemHit);
  565.     } while ((itemHit != ok) && (itemHit != cancel) && (itemHit != saveItem));
  566.  
  567.     if (itemHit == ok) {
  568.         GetDItem(theDialog, creatorItem, &type, &hdl, &box);
  569.         GetIText(hdl, text);
  570.         n = (unsigned char) text[0];
  571.         if (n > 4)
  572.             n = 4;
  573.  
  574.         memset(pref.creator, ' ', 4);
  575.         memcpy(pref.creator, &text[1], n);
  576.         GetDItem(theDialog, typeItem, &type, &hdl, &box);
  577.         GetIText(hdl, text);
  578.         n = (unsigned char) text[0];
  579.         if (n > 4)
  580.             n = 4;
  581.  
  582.         memset(pref.type, ' ', 4);
  583.         memcpy(pref.type, &text[1], n);
  584.     }
  585.     
  586.     DisposDialog(theDialog);
  587.     SetPort(thePort);
  588. }
  589.  
  590. /*
  591.  * DoInsertFloppy - put the floppy dialog on the screen
  592.  */
  593. int
  594. DoInsertFloppy(void)
  595. {
  596.     short        itemHit;
  597.     DialogPtr    theDialog;
  598.  
  599.     drive = 0;
  600.     theDialog = GetNewDialog(floppyID, nil, (WindowPtr) -1);
  601.     do {
  602.         ModalDialog(FloppyFilter, &itemHit);
  603.         if (itemHit == ejectItem) {
  604.             DiskEject(1);
  605.             DiskEject(2);
  606.         }
  607.     } while ((itemHit != ok) && (itemHit != cancel));
  608.  
  609.     DisposDialog(theDialog);
  610.     return(drive);
  611. }
  612.  
  613. /*
  614.  * OSAlert - put a generic OS Error Alert on the screen
  615.  *
  616.  *    Used for errors not handled in another way (yet).
  617.  */
  618. OSAlert(char *p0, char *p1, char *p2, OSErr err)
  619. {
  620.     char    buf[256];
  621.  
  622.     /*
  623.      * Manage the contingency of being called for resources missing!
  624.      */
  625.     if (GetResource('ALRT', osErrID) == nil) {
  626.         GrafPtr    wmPort;
  627.         long    t;
  628.         Rect    r;
  629.  
  630.         GetWMgrPort(&wmPort);
  631.         SetPort(wmPort);
  632.         SetRect(&r, 140, 150, 360, 180);
  633.         EraseRect(&r);
  634.         MoveTo(150,170);
  635.         DrawString("\pPANIC! Resources Missing!");
  636.         Delay(600L, &t);
  637.         ExitToShell();
  638.     }
  639.  
  640.     NumToString((long) err, buf);
  641.     ParamText(p0, p1, p2, buf);
  642.     StopAlert(osErrID, nil);
  643. }
  644.  
  645. /*
  646.  * PgmAlert - put a program logic alert on the screen
  647.  */
  648. int
  649. PgmAlert(char *p0, char *p1, char *p2)
  650. {
  651.     ParamText(p0, p1, p2, nil);
  652.     return(StopAlert(pgmErrID, nil));
  653. }
  654.  
  655. /*
  656.  * HFSAlert - put a "HFS only" alert on the screen
  657.  */
  658. void
  659. HFSAlert(void)
  660. {
  661.     StopAlert(hfsID, nil);
  662. }
  663.  
  664. /*
  665.  * VersionAlert - put a "6.0.5 or later" alert on the screen
  666.  */
  667. void
  668. VersionAlert(void)
  669. {
  670.     StopAlert(versionID, nil);
  671. }
  672.  
  673. /*
  674.  * DFAlert -  Oops, disk is full
  675.  */
  676. void
  677. DFAlert(void)
  678.     StopAlert(dfID, nil);
  679. }
  680.  
  681. /*
  682.  * ArSkipAlert - put a "skipping archive file" note on the screen
  683.  */
  684. void
  685. ArSkipAlert(void)
  686. {
  687.     NoteAlert(askipID, nil);
  688. }
  689.  
  690. /*
  691.  * StkErrAlert - put a stack corrupted alert on the screen
  692.  */
  693. void
  694. StkErrAlert(void)
  695. {
  696.     StopAlert(stkErrID, nil);
  697.     ExitToShell();
  698. }
  699.  
  700. /*
  701.  * StopGoAlert - put an alert on the screen
  702.  */
  703. Boolean
  704. StopGoAlert(const char *p0)
  705. {
  706.     ParamText(p0, nil, nil, nil);
  707.     if (StopAlert(stopGoID, nil) == ok)
  708.         return(false);
  709.         
  710.     return(true);
  711. }
  712.  
  713. /*
  714.  * PgmAlert - put a program logic alert on the screen
  715.  */
  716. void
  717. GenericAlert(const char *p0)
  718. {
  719.     ParamText(p0, nil, nil, nil);
  720.     StopAlert(genericID, nil);
  721. }
  722.  
  723.